home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / CREATNEW.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  539 b   |  23 lines

  1. /* creatnew.c --- p 489 */
  2. #include <stdio.h>
  3. #include <dos.h>
  4. #include <io.h>
  5. extern unsigned char _osmajor;
  6. main()
  7. {
  8.     int handle;
  9.     char filename[60];
  10.     if(_osmajor <3)
  11.     {
  12.         printf("'creatnew' needs DOS version 3.0 or higher\n");
  13.         exit(0);
  14.     }
  15.     printf("Enter name of file to be created: ");
  16.     gets(filename);
  17.             /* Call 'creatnew' to create the file. Mode 0 means
  18.              * a normal file. */
  19.     if((handle = creatnew(filename, 0)) == -1)
  20.         perror("Error in creatnew");
  21.     else
  22.         printf("File %s created\n", filename);
  23. }